#include "GameData.h"
#include "state/GamestateManager.h"
#include "state/GamestateFree.h"

#include "render/GameRenderer.h"
#include "gui/FontManager.h"
#include "gui/GuiManager.h"
#include "TextureManager.h"

#include "object/SceneManager.h"
#include "camera/Camera.h"

GameData::GameData(const int scr_size[]): _run_code(0){
    _state_manager = new GamestateManager();
    _state_manager->add_state("free", new GamestateFree(this));

    _camera = new Camera();
    _renderer = new GameRenderer(this);
    _renderer->init();
    _renderer->resize(scr_size[0], scr_size[1]);

    _font = new FontManager();
    _gui = new GuiManager(scr_size[0], scr_size[1], _font);

    _texture_manager = TextureManager::getInstance();
    _scene = new SceneManager();
    

}

GameData::~GameData() {
    delete _state_manager;
    delete _camera;
    delete _renderer;
    delete _gui;
    delete _font;
    delete _scene;
    delete _texture_manager;
}

GamestateManager* GameData::state_manager() {
    return _state_manager;
}

Camera* GameData::camera() {
    return _camera;
}

GameRenderer* GameData::renderer() {
    return _renderer;
}

GuiManager* GameData::gui() {
    return _gui;
}

TextureManager* GameData::texture_manager() {
    return _texture_manager;
}
SceneManager* GameData::scene() {
    return _scene;
}

FontManager* GameData::font() {
    return _font;
}

int GameData::run_code() {
    return _run_code;
}

void GameData::set_run_code(int c) {
    _run_code = c;
}